package day12_thread_code.com.itheima.d2_thread_api;

public class Demo3_Thread {
    public static void main(String[] args) throws InterruptedException {
        MyThread2 t = new MyThread2();
        t.start();

        for (int i = 0; i < 4; i++) {
            System.out.println("主线程输出：" + i);
            if (i == 2){
                t.join();
            }
        }
    }
}
class MyThread2 extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println("线程1：" + i);
        }
    }
}
